use :: libc;
extern "C" {
    fn memcmp(_: *const libc::c_void, _: *const libc::c_void, _: u64) -> i32;
    fn utf8_towc(_: *const utf8_data, _: *mut wchar_t) -> utf8_state;
    fn utf8_in_table(_: wchar_t, _: *const wchar_t, _: u_int) -> i32;
}
pub type __u_char = u8;
pub type __u_int = u32;
pub type u_char = __u_char;
pub type u_int = __u_int;
pub type wchar_t = i32;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct utf8_data {
    pub data: [u_char; 21],
    pub have: u_char,
    pub size: u_char,
    pub width: u_char,
}
pub type utf8_state = u32;
pub const UTF8_ERROR: utf8_state = 2;
pub const UTF8_DONE: utf8_state = 1;
pub const UTF8_MORE: utf8_state = 0;
static mut utf8_modifier_table: [wchar_t; 31] = [
    0x1f1e6 as i32,
    0x1f1e7 as i32,
    0x1f1e8 as i32,
    0x1f1e9 as i32,
    0x1f1ea as i32,
    0x1f1eb as i32,
    0x1f1ec as i32,
    0x1f1ed as i32,
    0x1f1ee as i32,
    0x1f1ef as i32,
    0x1f1f0 as i32,
    0x1f1f1 as i32,
    0x1f1f2 as i32,
    0x1f1f3 as i32,
    0x1f1f4 as i32,
    0x1f1f5 as i32,
    0x1f1f6 as i32,
    0x1f1f7 as i32,
    0x1f1f8 as i32,
    0x1f1f9 as i32,
    0x1f1fa as i32,
    0x1f1fb as i32,
    0x1f1fc as i32,
    0x1f1fd as i32,
    0x1f1fe as i32,
    0x1f1ff as i32,
    0x1f3fb as i32,
    0x1f3fc as i32,
    0x1f3fd as i32,
    0x1f3fe as i32,
    0x1f3ff as i32,
];
#[no_mangle]
pub extern "C" fn utf8_has_zwj(mut ud: *const utf8_data) -> i32 {
    if ((unsafe { (*ud).size }) as i32) < 3 as i32 {
        return 0 as i32;
    }
    return ((unsafe {
        memcmp(
            ((*ud).data)
                .as_ptr()
                .offset((*ud).size as i32 as isize)
                .offset(-(3 as i32 as isize)) as *const libc::c_void,
            b"\xE2\x80\x8D\0" as *const u8 as *const i8 as *const libc::c_void,
            3 as i32 as u64,
        )
    }) == 0 as i32) as i32;
}
#[no_mangle]
pub extern "C" fn utf8_is_zwj(mut ud: *const utf8_data) -> i32 {
    if (unsafe { (*ud).size }) as i32 != 3 as i32 {
        return 0 as i32;
    }
    return ((unsafe {
        memcmp(
            ((*ud).data).as_ptr() as *const libc::c_void,
            b"\xE2\x80\x8D\0" as *const u8 as *const i8 as *const libc::c_void,
            3 as i32 as u64,
        )
    }) == 0 as i32) as i32;
}
#[no_mangle]
pub extern "C" fn utf8_is_vs(mut ud: *const utf8_data) -> i32 {
    if (unsafe { (*ud).size }) as i32 != 3 as i32 {
        return 0 as i32;
    }
    return ((unsafe {
        memcmp(
            ((*ud).data).as_ptr() as *const libc::c_void,
            b"\xEF\xB8\x8F\0" as *const u8 as *const i8 as *const libc::c_void,
            3 as i32 as u64,
        )
    }) == 0 as i32) as i32;
}
#[no_mangle]
pub extern "C" fn utf8_is_modifier(mut ud: *const utf8_data) -> i32 {
    let mut wc: wchar_t = 0;
    if (unsafe { utf8_towc(ud, &mut wc) }) as u32 != UTF8_DONE as i32 as u32 {
        return 0 as i32;
    }
    if (unsafe {
        utf8_in_table(
            wc,
            utf8_modifier_table.as_ptr(),
            (::core::mem::size_of::<[wchar_t; 31]>() as u64)
                .wrapping_div(::core::mem::size_of::<wchar_t>() as u64) as u_int,
        )
    }) == 0
    {
        return 0 as i32;
    }
    return 1 as i32;
}
